// 自定义 Button 组件样式
.cn-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  text-align: center;
  user-select: none;
  box-sizing: border-box;

  // 统一尺寸：高度 45px，圆角 10px
  height: 45px !important;
  line-height: 45px !important;
  --adm-button-height: 45px !important;
  padding: 0 20px !important;
  border-radius: 10px !important;
  min-width: 80px;

  // 默认类型样式
  &.cn-button-default {
    background: #f0f0f0 !important;
    color: #00a3ff !important;
    font-size: 14px;
    line-height: 45px;
    font-weight: 400;
    &:hover:not(.cn-button-disabled):not(.cn-button-loading) {
      background: #e0e0e0 !important;
    }

    &:active:not(.cn-button-disabled):not(.cn-button-loading) {
      background: #d0d0d0 !important;
    }
  }

  // Primary 类型样式
  &.cn-button-primary {
    background: radial-gradient(
      0% 0% at 0% 0%,
      #00a3ff 0%,
      #65b3ff 100%
    ) !important;
    color: #fff !important;
    font-size: 14px;
    line-height: 45px;

    &:hover:not(.cn-button-disabled):not(.cn-button-loading) {
      background: radial-gradient(
        0% 0% at 0% 0%,
        #0088cc 0%,
        #4a9fff 100%
      ) !important;
    }

    &:active:not(.cn-button-disabled):not(.cn-button-loading) {
      background: radial-gradient(
        0% 0% at 0% 0%,
        #006699 0%,
        #3385cc 100%
      ) !important;
    }
  }

  // 图标样式
  .cn-button-icon {
    font-size: 16px;
    line-height: 1;
    margin-right: 4px;
  }
}

// 背景图片按钮样式
.cn-background-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  text-align: center;
  user-select: none;
  box-sizing: border-box;

  // 统一尺寸
  height: 45px;
  line-height: 45px;
  padding: 0 20px;
  border-radius: 10px;
  min-width: 80px;

  // 背景图片设置
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;

  // Primary类型
  &.cn-background-button-primary {
    color: #fff;
    font-size: 14px;
  }

  // Default类型
  &.cn-background-button-default {
    color: #00a3ff;
    font-size: 14px;
  }

  // 块级按钮
  &.cn-background-button-block {
    width: 100%;
    display: flex;
  }

  // 交互效果
  &:active {
    transform: scale(0.95);
    opacity: 0.8;
  }

  // 禁用状态
  &.cn-background-button-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }

  // Loading状态
  &.cn-background-button-loading {
    cursor: not-allowed;

    .cn-button-loading {
      margin-right: 8px;
      animation: spin 1s linear infinite;
    }
  }

  // 图标样式
  .cn-button-icon {
    font-size: 16px;
    line-height: 1;
    margin-right: 4px;
  }
}

// 旋转动画
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

// 块级按钮
&.cn-button-block {
  width: 100% !important;
  display: flex;
}

// 图标样式
.cn-button-icon {
  font-size: 16px;
  line-height: 1;
  margin-right: 4px;
}

// 组合容器样式
.cn-button-group {
  display: flex;
}

.cn-button-group-row {
  flex-direction: row;
}

.cn-button-group-column {
  flex-direction: column;
}

.cn-button-group-equal {
  > .cn-button {
    flex: 1 1 0;
    width: auto;
  }
}
